import { defineStore } from 'pinia'

const useAppStore = defineStore('app', {
    state: () => ({
        token: '',
        openId: '',
        system: '',
        qrCodeData: null
    }),
    actions: {
        setToken(token) {
            this.token = token
        },
        setOpenId(openId) {
            this.openId = openId
        },
        setSystem(system) {
            this.system = system
        },
        setQrCodeData(qrCodeData) {
            this.qrCodeData = qrCodeData
        },
        logOut() {
            this.token = ''
            uni.clearStorage()
        }
    }
})

export default useAppStore